/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.au.uq.datamining.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author oracle
 */
@Entity
@Table(name = "TNATURALINFORMACIONBASICA", catalog = "", schema = "FITINT")
@NamedQueries({
    @NamedQuery(name = "BasicInfo.findAll", query = "SELECT b FROM BasicInfo b"),
    @NamedQuery(name = "BasicInfo.findByCpersona", query = "SELECT b FROM BasicInfo b WHERE b.basicInfoPK.cpersona = :cpersona"),
    @NamedQuery(name = "BasicInfo.findByFhasta", query = "SELECT b FROM BasicInfo b WHERE b.basicInfoPK.fhasta = :fhasta"),
    @NamedQuery(name = "BasicInfo.findByFdesde", query = "SELECT b FROM BasicInfo b WHERE b.fdesde = :fdesde"),
    @NamedQuery(name = "BasicInfo.findByApellidopaterno", query = "SELECT b FROM BasicInfo b WHERE b.apellidopaterno = :apellidopaterno"),
    @NamedQuery(name = "BasicInfo.findByApellidomaterno", query = "SELECT b FROM BasicInfo b WHERE b.apellidomaterno = :apellidomaterno"),
    @NamedQuery(name = "BasicInfo.findByPrimernombre", query = "SELECT b FROM BasicInfo b WHERE b.primernombre = :primernombre"),
    @NamedQuery(name = "BasicInfo.findBySegundonombre", query = "SELECT b FROM BasicInfo b WHERE b.segundonombre = :segundonombre"),
    @NamedQuery(name = "BasicInfo.findByGenero", query = "SELECT b FROM BasicInfo b WHERE b.genero = :genero"),
    @NamedQuery(name = "BasicInfo.findByCestadocivil", query = "SELECT b FROM BasicInfo b WHERE b.cestadocivil = :cestadocivil"),
    @NamedQuery(name = "BasicInfo.findByApellidocasada", query = "SELECT b FROM BasicInfo b WHERE b.apellidocasada = :apellidocasada"),
    @NamedQuery(name = "BasicInfo.findByFnacimiento", query = "SELECT b FROM BasicInfo b WHERE b.fnacimiento = :fnacimiento"),
    @NamedQuery(name = "BasicInfo.findByTipodomicilio", query = "SELECT b FROM BasicInfo b WHERE b.tipodomicilio = :tipodomicilio"),
    @NamedQuery(name = "BasicInfo.findByEmancipado", query = "SELECT b FROM BasicInfo b WHERE b.emancipado = :emancipado"),
    @NamedQuery(name = "BasicInfo.findByHomonimia", query = "SELECT b FROM BasicInfo b WHERE b.homonimia = :homonimia"),
    @NamedQuery(name = "BasicInfo.findByVersioncontrol", query = "SELECT b FROM BasicInfo b WHERE b.versioncontrol = :versioncontrol"),
    @NamedQuery(name = "BasicInfo.findByCusuarioIngreso", query = "SELECT b FROM BasicInfo b WHERE b.cusuarioIngreso = :cusuarioIngreso"),
    @NamedQuery(name = "BasicInfo.findByCusuarioModificacion", query = "SELECT b FROM BasicInfo b WHERE b.cusuarioModificacion = :cusuarioModificacion"),
    @NamedQuery(name = "BasicInfo.findByFingreso", query = "SELECT b FROM BasicInfo b WHERE b.fingreso = :fingreso"),
    @NamedQuery(name = "BasicInfo.findByFmodificacion", query = "SELECT b FROM BasicInfo b WHERE b.fmodificacion = :fmodificacion"),
    @NamedQuery(name = "BasicInfo.findByFresidencia", query = "SELECT b FROM BasicInfo b WHERE b.fresidencia = :fresidencia")})
public class BasicInfo implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BasicInfoPK basicInfoPK;
    @Basic(optional = false)
    @Column(name = "FDESDE", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date fdesde;
    @Basic(optional = false)
    @Column(name = "APELLIDOPATERNO", nullable = false, length = 25)
    private String apellidopaterno;
    @Column(name = "APELLIDOMATERNO", length = 25)
    private String apellidomaterno;
    @Basic(optional = false)
    @Column(name = "PRIMERNOMBRE", nullable = false, length = 20)
    private String primernombre;
    @Column(name = "SEGUNDONOMBRE", length = 30)
    private String segundonombre;
    @Basic(optional = false)
    @Column(name = "GENERO", nullable = false, length = 1)
    private String genero;
    @Basic(optional = false)
    @Column(name = "CESTADOCIVIL", nullable = false)
    private short cestadocivil;
    @Column(name = "APELLIDOCASADA", length = 25)
    private String apellidocasada;
    @Basic(optional = false)
    @Column(name = "FNACIMIENTO", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date fnacimiento;
    @Column(name = "TIPODOMICILIO", length = 1)
    private String tipodomicilio;
    @Column(name = "EMANCIPADO", length = 1)
    private String emancipado;
    @Column(name = "HOMONIMIA", length = 1)
    private String homonimia;
    @Column(name = "VERSIONCONTROL")
    private BigInteger versioncontrol;
    @Column(name = "CUSUARIO_INGRESO", length = 12)
    private String cusuarioIngreso;
    @Column(name = "CUSUARIO_MODIFICACION", length = 12)
    private String cusuarioModificacion;
    @Column(name = "FINGRESO")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fingreso;
    @Column(name = "FMODIFICACION")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fmodificacion;
    @Column(name = "FRESIDENCIA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fresidencia;
    @JoinColumn(name = "CPERSONA", referencedColumnName = "CPERSONA", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Tpersonaid tpersonaid;

    public BasicInfo() {
    }

        public BasicInfo(BasicInfoPK basicInfoPK, String apellidopaterno, String apellidomaterno, String primernombre, String segundonombre, String genero, Short cestadocivil, String tipodomicilio) {
        this.basicInfoPK = basicInfoPK;
        this.apellidopaterno = apellidopaterno;
        this.apellidomaterno = apellidomaterno;
        this.primernombre = primernombre;
        this.segundonombre = segundonombre;
        this.genero = genero;
        this.cestadocivil = cestadocivil;
        this.tipodomicilio = tipodomicilio;
        this.fdesde=new Date();
    }

    public BasicInfo(BasicInfoPK basicInfoPK) {
        this.basicInfoPK = basicInfoPK;
    }

    public BasicInfo(BasicInfoPK basicInfoPK, Date fdesde, String apellidopaterno, String primernombre, String genero, short cestadocivil, Date fnacimiento) {
        this.basicInfoPK = basicInfoPK;
        this.fdesde = fdesde;
        this.apellidopaterno = apellidopaterno;
        this.primernombre = primernombre;
        this.genero = genero;
        this.cestadocivil = cestadocivil;
        this.fnacimiento = fnacimiento;
    }

    public BasicInfo(int cpersona, Date fhasta) {
        this.basicInfoPK = new BasicInfoPK(cpersona, fhasta);
    }

    public BasicInfoPK getBasicInfoPK() {
        return basicInfoPK;
    }

    public void setBasicInfoPK(BasicInfoPK basicInfoPK) {
        this.basicInfoPK = basicInfoPK;
    }

    public Date getFdesde() {
        return fdesde;
    }

    public void setFdesde(Date fdesde) {
        this.fdesde = fdesde;
    }

    public String getApellidopaterno() {
        return apellidopaterno;
    }

    public void setApellidopaterno(String apellidopaterno) {
        this.apellidopaterno = apellidopaterno;
    }

    public String getApellidomaterno() {
        return apellidomaterno;
    }

    public void setApellidomaterno(String apellidomaterno) {
        this.apellidomaterno = apellidomaterno;
    }

    public String getPrimernombre() {
        return primernombre;
    }

    public void setPrimernombre(String primernombre) {
        this.primernombre = primernombre;
    }

    public String getSegundonombre() {
        return segundonombre;
    }

    public void setSegundonombre(String segundonombre) {
        this.segundonombre = segundonombre;
    }

    public String getGenero() {
        return genero;
    }

    public void setGenero(String genero) {
        this.genero = genero;
    }

    public short getCestadocivil() {
        return cestadocivil;
    }

    public void setCestadocivil(short cestadocivil) {
        this.cestadocivil = cestadocivil;
    }

    public String getApellidocasada() {
        return apellidocasada;
    }

    public void setApellidocasada(String apellidocasada) {
        this.apellidocasada = apellidocasada;
    }

    public Date getFnacimiento() {
        return fnacimiento;
    }

    public void setFnacimiento(Date fnacimiento) {
        this.fnacimiento = fnacimiento;
    }

    public String getTipodomicilio() {
        return tipodomicilio;
    }

    public void setTipodomicilio(String tipodomicilio) {
        this.tipodomicilio = tipodomicilio;
    }

    public String getEmancipado() {
        return emancipado;
    }

    public void setEmancipado(String emancipado) {
        this.emancipado = emancipado;
    }

    public String getHomonimia() {
        return homonimia;
    }

    public void setHomonimia(String homonimia) {
        this.homonimia = homonimia;
    }

    public BigInteger getVersioncontrol() {
        return versioncontrol;
    }

    public void setVersioncontrol(BigInteger versioncontrol) {
        this.versioncontrol = versioncontrol;
    }

    public String getCusuarioIngreso() {
        return cusuarioIngreso;
    }

    public void setCusuarioIngreso(String cusuarioIngreso) {
        this.cusuarioIngreso = cusuarioIngreso;
    }

    public String getCusuarioModificacion() {
        return cusuarioModificacion;
    }

    public void setCusuarioModificacion(String cusuarioModificacion) {
        this.cusuarioModificacion = cusuarioModificacion;
    }

    public Date getFingreso() {
        return fingreso;
    }

    public void setFingreso(Date fingreso) {
        this.fingreso = fingreso;
    }

    public Date getFmodificacion() {
        return fmodificacion;
    }

    public void setFmodificacion(Date fmodificacion) {
        this.fmodificacion = fmodificacion;
    }

    public Date getFresidencia() {
        return fresidencia;
    }

    public void setFresidencia(Date fresidencia) {
        this.fresidencia = fresidencia;
    }

    public Tpersonaid getTpersonaid() {
        return tpersonaid;
    }

    public void setTpersonaid(Tpersonaid tpersonaid) {
        this.tpersonaid = tpersonaid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (basicInfoPK != null ? basicInfoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BasicInfo)) {
            return false;
        }
        BasicInfo other = (BasicInfo) object;
        if ((this.basicInfoPK == null && other.basicInfoPK != null) || (this.basicInfoPK != null && !this.basicInfoPK.equals(other.basicInfoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.au.uq.datamining.entity.BasicInfo[basicInfoPK=" + basicInfoPK + "]";
    }

}
